<!DOCTYPE html>
<html lang="en" class="no-js">

    <head>

        <meta charset="utf-8">
        <title>程序员后台</title>
        <!-- CSS -->
   
        <link rel="stylesheet" href="/res/plugins/programmer/css/supersized.css">
        <link rel="stylesheet" href="/res/plugins/programmer/css/style.css">

    </head>

    <body>

        <div class="page-container">
            <h1>程序员后台</h1>
            <form action="" method="post"onsubmit="return false">
                <div>
					<input type="password"  name="password" placeholder="请输入登陆密码"/>


                </div>
                <button id="submit" type="button">登陆</button>
            </form>
        </div>
        <!-- Javascript -->
        <script src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
        <script src="/res/plugins/programmer/js/supersized.3.2.7.min.js"></script>
        <script src="/res/plugins/programmer/js/supersized-init.js"></script>
        <script src="https://static.9hive.cn/global/vendor/layer/layer.js"></script>
		<script>
            $(function () {
                window.document.onkeypress = SubmitOrHidden;//当有键按下时执行函数
            });

            var SubmitOrHidden = function (evt) {
                evt = window.event || evt;
                if (evt.keyCode == 13) {//如果取到的键值是回车

                    login();
                } else {
                    //其他键  dosomething
                }
            };
            $("#submit").click(function () {
                login();
            });


            function login() {
                var password = $("input[name='password']").val();
                if(!password) {
                    layer.msg("密码不允许为空!");
                    return ;
                }
                $.ajax({
                    url: "/programmer/signIn",
                    type: 'GET',
                    data:{
                        "password": password
                    },
                    success: function(data){
                        if (data.state=="ok" == true){
                            window.location.href="/programmer";

                        }else{
                            layer.msg(data.info);
                        }
                    }});

            }
		</script>
    </body>

</html>

